package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Appealdetail;
import com.zjsd.sqeybusiness.service.IAppealdetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 申诉回复明细Controller
 *
 * @author Zheng
 * @date 2025-03-11
 */
@RestController
@RequestMapping("/sqeybusiness/appealdetail")
public class AppealdetailController extends BaseController
{
    @Autowired
    private IAppealdetailService appealdetailService;

    /**
     * 查询申诉回复明细列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:appealdetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(Appealdetail appealdetail)
    {
        startPage();
        List<Appealdetail> list = appealdetailService.selectAppealdetailList(appealdetail);
        return getDataTable(list);
    }

    /**
     * 导出申诉回复明细列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:appealdetail:export')")
    //@Log(title = "申诉回复明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Appealdetail appealdetail)
    {
        List<Appealdetail> list = appealdetailService.selectAppealdetailList(appealdetail);
        ExcelUtil<Appealdetail> util = new ExcelUtil<Appealdetail>(Appealdetail.class);
        return util.exportExcel(list, "appealdetail");
    }

    /**
     * 获取申诉回复明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:appealdetail:query')")
    @GetMapping(value = "/{detailid}")
    public AjaxResult getInfo(@PathVariable("detailid") Long detailid)
    {
        return AjaxResult.success(appealdetailService.selectAppealdetailById(detailid));
    }

    /**
     * 新增申诉回复明细
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:appealdetail:add')")
    //@Log(title = "申诉回复明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Appealdetail appealdetail)
    {
        return toAjax(appealdetailService.insertAppealdetail(appealdetail));
    }

    /**
     * 修改申诉回复明细
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:appealdetail:edit')")
    //@Log(title = "申诉回复明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Appealdetail appealdetail)
    {
        return toAjax(appealdetailService.updateAppealdetail(appealdetail));
    }

    /**
     * 删除申诉回复明细
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:appealdetail:remove')")
    //@Log(title = "申诉回复明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{detailids}")
    public AjaxResult remove(@PathVariable Long[] detailids)
    {
        return toAjax(appealdetailService.deleteAppealdetailByIds(detailids));
    }
}
